package cn.zhz.customview.view.record;

import android.app.AppComponentFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import cn.zhz.customview.R;

/**
 * @project: customViewDemo
 * @author: ZhuangHZ
 * @createTime: 2019/6/5 21:36
 * @describe:
 * @version:
 */
public class RecordActivity extends AppCompatActivity implements View.OnClickListener {

    private RecordWaveView waveView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recoed_layout);

        initView();
    }

    private void initView() {
        waveView = this.findViewById(R.id.RecordWaveView);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_start:
                if(!waveView.isStarted()){
                    waveView.startAnim();
                }
                break;
            case R.id.btn_stop:
                if(waveView.isStarted()){
                    waveView.stopLineAnimation();
                }
                break;
            case R.id.btn_reset:
                waveView.resetLineAnimation();
                break;


        }
    }
}
